import java.util.Scanner;
import java.util.InputMismatchException;
class StudentTest {
    public static void main(String[] args) {
        Student[] arr = new Student[5];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入学生姓名");
            String name = sc.next();
            while (true){
                try{
                    System.out.println("请输入学生分数");
                    double score = sc.nextDouble();
                    Student stu = new Student(name,score);
                    arr[i] = stu;
                    break;
                }catch (InputMismatchException e){
                    sc.nextLine();
                    System.out.println("输入格式有问题");
                }
            }
            System.out.println("是否继续输入？ a：继续");
           String s = sc.next();
            if (! s.equalsIgnoreCase("a")) {
                System.out.println("姓名\t分数");
                for (int k = 0; k < arr.length; k++) {
                    if (arr[k] == null) return;
                    System.out.println(arr[k]);
                }
            }
        }
    }

}